using GraphQLDemo.Domain.Companies;

namespace GraphQLDemo.Infrastructure.Repositories
{
    public class CompanyRepository : ICompanyRepository
    {
        public Task<IDictionary<Guid, Company>> GetCompanysByIdAsync(IEnumerable<Guid> companyIds, CancellationToken cancellationToken)
        {
            Console.WriteLine("Execute CompanyRepository-GetCompanysByIdAsync");

            var companies = new Dictionary<Guid, Company>()
            {
                {
                    Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340000"),
                    new Company()
                    {
                        Id = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340000"),
                        Name = "company1"
                    }
                },
                {
                    Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340001"),
                    new Company()
                    {
                        Id = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340001"),
                        Name = "company2"
                    }
                }
            };

            return Task.FromResult((IDictionary<Guid, Company>)companies);
        }

        public Task<List<Company>> GetListAsync()
        {
            Console.WriteLine("Execute CompanyProjectRepository-GetListAsync");

            var companies = new List<Company>()
            {
                new Company()
                {
                    Id = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340000"),
                    Name = "company1"
                },
                new Company()
                {
                    Id = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340001"),
                    Name = "company2"
                }
            };

            return Task.FromResult(companies);
        }
    }
}